<script>
	ON('ready', function() {

		$('header').prepend('<div class="pull-right"><div class="toolbar"><button style="min-width:28px" class="exec" data-exec="showbookmarks"><i class="ti ti-bookmark nmr"></i></button></div></div>');

		W.showbookmarks = function(el) {

			var opt = {};

			opt.element = el;
			opt.align = 'right';
			opt.offsetY = 30;
			opt.offsetWidth = 300;
			opt.callback = function(selected) {
				W.open(selected.url);
			};

			TAPI('bookmarks', function(response) {
				opt.items = [];
				for (var m of response)
					opt.items.push({ id: m.id, name: m.name, url: m.url });
				SETTER('directory/show', opt);
			});
		};

	});
</script>